#include<bits/stdc++.h>
using namespace std;
#define gc getchar
#define pc putchar
#define pb push_back
#define mp make_pair
#define ls (id<<1)
#define rs ((id<<1)|1)
#define mid ((l+r)>>1)
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rof(i,a,b) for(int i=(a);i>=(b);--i)

int read(){
    int ret=0,f=0; char ch=gc();
    while(ch<'0'||ch>'9') f|=(ch=='-'),ch=gc();
    while(ch>='0'&&ch<='9') ret=(ret<<1)+(ret<<3)+(ch^48),ch=gc();
    return f?-ret:ret;
}

void write(int x){
    if(!x) return pc('0'),void();
    if(x<0) pc('-'),x=-x;
    int stk[30],tp=0;
    while(x) stk[++tp]=x%10,x/=10;
    while(tp) pc('0'+stk[tp--]);
    return;
}

const int Maxn=2e5+10;
int N,L,A[Maxn],B[Maxn],Ans,f[2010][2010];

void DFS(int x,int l,int r){
    if(x>N){ if(l<=L) Ans=max(Ans,r); return; }
    DFS(x+1,l^A[x],r^B[x]); DFS(x+1,l,r);
}

int main(){
    freopen("lock.in","r",stdin);
    freopen("lock.out","w",stdout);
    N=read(),L=read(); For(i,1,N) A[i]=read(),B[i]=read();
    if(N<=18) DFS(1,0,0),write(Ans),exit(0);
    memset(f,-0x3f,sizeof f); f[0][0]=0;
    For(i,1,N) For(j,0,L) 
        f[i][j]=max(f[i][j],max(f[i-1][j],f[i-1][j^A[i]]^B[i]));
    For(i,0,L) Ans=max(Ans,f[N][i]);
    write(Ans);
    return 0;
}